// 开发状态
export const developStatus = [
  {
    label: '未开始',
    value: 1,
  },
  {
    label: '开发中',
    value: 2,
  },
  {
    label: '测试中',
    value: 3,
  },
  {
    label: '已上线',
    value: 4,
  },
  {
    label: '已验收',
    value: 5,
  },
  {
    label: '暂停',
    value: 6,
  },
  {
    label: '取消上线',
    value: 7,
  },
];
// 需求状态
export const storyStatus = {
  planning: '需求发起',
  resolved: 'PRD撰写中',
  rejected: '已拒绝',
  status_2: '需求评审未通过',
  status_3: '排期中（PRD评审通过）',
  status_4: '开发中',
  status_5: '生产发布完成',
  status_6: '需求暂停',
  status_7: '项目目标review',
  status_8: '归档',
  status_9: '灰度验证完成',
  status_10: '提交测试（UI走查）',
  status_11: '测试完成（待灰度UI走查完成）',
  status_13: 'PRD完成（待评审、UI设计中）',
  status_17: '保持为排期完成（待进入开发）',
  status_20: '实现中',
  status_21: '已实现',
  status_24: '数据开发中',
  status_25: '数据开发完成',
  status_26: '取消',
  status_27: '已接收',
  status_28: '需求关闭',
  status_29: '需求评审',
  status_30: '设计开始',
  status_31: '设计评审',
  status_32: '设计完成',
  status_33: '上线',
  status_35: 'UI设计完成',
  status_38: '已复盘',
  status_39: '开始验收',
  status_40: '验收完成',
  status_41: '需求粗评',
  status_42: '需求待启动',
};
// 上线相关需求status的状态码
// status_5: '生产发布完成',status_7: '项目目标review',status_8: '归档',status_33: '上线',status_39: '开始验收',status_40: '验收完成',status_28: '需求关闭', status_21: '已实现'
export const onlineStoryStatus = ['status_5', 'status_7', 'status_8', 'status_21', 'status_33', 'status_39', 'status_40', 'status_28'];
// 需求来源
export const storySource = {
  tapd: 'tapd',
  local: '自创建',
};

export const storyOptions = Object.keys(storyStatus).map((item) => ({
  label: storyStatus[item],
  value: item,
}));
// 项目环境
export const env = [
  {
    label: 'dev',
    value: 'dev',
    position: 'left',
  },
  {
    label: 'dev2',
    value: 'dev2',
    position: 'left',
  },
  {
    label: 'dev3',
    value: 'dev3',
    position: 'left',
  },
  {
    label: 'dev4',
    value: 'dev4',
    position: 'left',
  },
  {
    label: 'sit',
    value: 'sit',
    position: 'right',
  },
  {
    label: 'uat',
    value: 'uat',
    position: 'right',
  },
  {
    label: '体验版',
    value: 'develop_experience',
    position: 'right',
  },
  {
    label: '正式版',
    value: 'develop_formal',
    position: 'right',
  },
];
// 代码reviewer
export const reviewer = [
  {
    label: '米雪花',
    value: '10055792',
    color: '#90EE90',
  },
  {
    label: '李国宾',
    value: '10061227',
    color: '#FFD700',
  },
  {
    label: '聂乐凯',
    value: '10057860',
    color: '#FF6347',
  },
  {
    label: '郑昌军',
    value: '10060199',
    color: '#00FFFF',
  },
];
// review状态
export const reviewStatus = [
  {
    label: '已通过',
    value: 2,
  },
  {
    label: '待修改',
    value: 1,
  },
  {
    label: '未查验',
    value: 0,
  },
];
// 需求状态
export const publishStatus = [
  {
    label: '已发布',
    value: 1,
  },
  {
    label: '待发布',
    value: 0,
  },
];
// 是否展示在脑图上
export const showInMindOptions = [
  {
    label: '是',
    value: 1,
  },
  {
    label: '否',
    value: 0,
  },
];
// tapd对应字段
export const tapd2types = {
  custom_field_9: 'production_owner', // 产品owner，字段示例：["张三", "李四"]
  custom_field_10: 'publish_time', // 发布时间
  custom_field_11: 'develop_start_time', // 开发开始时间
  develop_start_time: 'develop_start_time',
  custom_field_12: 'develop_uniting', // 联调时间
  develop_uniting: 'develop_uniting',
  custom_field_13: 'gray_time', // 灰度时间
  gray_time: 'gray_time',
  custom_field_14: 'check_time', // 验收时间
  check_time: 'check_time',
  custom_field_16: 'excpect_online_time', // 期望上线时间
  custom_field_two: 'submit_test_time', // 提测时间
  submit_test_time: 'submit_test_time',
  custom_field_six: 'develop_owner', // 技术owner列表，字段示例：["张三"]
  custom_field_seven: 'operation_owner', // 运营owner，字段示例：["张三", "李四"]
  custom_field_eight: 'object_review_time', // 目标review时间
  name: 'name', // tapd需求名称
  id: 'id', // tapd中的需求id
  object_type: 'object_type', // story：事件类型
  status: 'status', // 需求状态
  reviewer: 'reviewer', // 代码查验人
  relation_projects: 'relation_projects', // 需求关联项目
  created: 'created', // 需求创建时间
  online_time: 'online_time', // 上线时间
  source: 'source', // 需求来源
  _id: '_id', // 数据库id
  schedulePlan: 'schedulePlan', // 排期计划
};

export const groups = [
  {
    label: 'PC战队',
    value: 'pc',
  },
  {
    label: '小程序战队',
    value: 'mini',
  },
  {
    label: 'H5战队',
    value: 'h5',
  },
  {
    label: '跨平台战队',
    value: 'multi',
  },
];

export const checkStatus = [
  {
    label: '已验收',
    value: 1,
  },
  {
    label: '验收中',
    value: 0,
  },
  {
    label: '未验收',
    value: 2,
  },
];

// 开发分支合并状态
export const branchMergeStatus = [
  {
    label: '待合并',
    value: 1,
  },
  {
    label: '合并中',
    value: 2,
  },
  {
    label: '已合并',
    value: 3,
  },
  {
    label: '不需要',
    value: 0,
  },
];

// 统一合并分支是否已经合并到主分支
export const mainBranchMergeStatus = [
  {
    label: '已合并',
    value: 1,
  },
  {
    label: '未合并',
    value: 0,
  },
  {
    label: '合并中',
    value: 2,
  },
  {
    label: '合并关闭',
    value: 3,
  },
];

export const tapdUrl = 'https://www.tapd.cn/41194427/prong/stories/view/';

export const planFormItems = [
  {
    name: 'owner',
    label: '技术owner',
    type: 'input',
  },
  {
    name: 'reviewTime',
    label: '需求评审时间',
    type: 'datePicker',
  },
  {
    name: 'frontEntryTime',
    label: '前端进入时间',
    type: 'datePicker',
  },
  {
    name: 'backendEntryTime',
    label: '后端进入时间',
    type: 'datePicker',
  },
  {
    name: 'appEntryTime',
    label: 'app进入时间',
    type: 'datePicker',
  },
  {
    name: 'BDEntryTime',
    label: '大数据进入时间',
    type: 'datePicker',
  },
  {
    name: 'intergratedTime',
    label: '进入联调时间',
    type: 'datePicker',
  },
  {
    name: 'smokingTime',
    label: '提供冒烟时间',
    type: 'datePicker',
  },
  {
    name: 'submitTestTime',
    label: '整体提测时间',
    type: 'datePicker',
  },
  {
    name: 'testTime',
    label: '测试介入时间',
    type: 'datePicker',
  },
  {
    name: 'checkTime',
    label: '预计验收时间',
    type: 'datePicker',
  },
  {
    name: 'onlineTime',
    label: '预计上线时间',
    type: 'datePicker',
  },
];

export const planInitFormValue = { requirement: [{}], front: [{}], backend: [{}], app: [{}], BD: [{}], case: [{}], test: [{}], cross: [{}], online: [{}] };

export const logTypeText = {
  1: '修改xx需求关联代码为xx的验收状态为 xx', // 需求 验收状态
  2: '修改xx的上线时间为 xx', // 需求 上线时间
  3: '修改xx的使用环境为 xx', // 需求 项目使用环境
  4: '修改xx关联的项目为 xx', // 需求 关联项目
  5: '修改xx的代码查验人为 xx', // 需求 代码查验人
  6: '创建xx的merge request', // 项目 创建mr
  7: '修改xx需求关联的xx的代码查验状态为 xx', // 项目 代码查验状态
  8: '在脑图给xx创建一个合并分支xx', // 项目 脑图创建合并分支
  9: 'xx完成xx的主分支合并操作', // 项目 合并完分支回调
  12: 'xx关闭xx的合并操作', // 项目  gitlab取消合并
  10: '修改了xx的密码', // 系统 修改密码
  11: '登录了系统', // 系统 登录
  13: '正在编辑xx的排期', // 需求。编辑排期上锁
  14: '创建了xx的排期', // 需求。创建排期
  15: '结束xx的排期', // 需求。编辑抛弃解锁
};

export const logType = {
  1: '需求',
  2: '项目',
  3: '系统',
  4: '钉钉',
};

const gitlab_merge_request_callback = {
  object_kind: 'merge_request',
  event_type: 'merge_request',
  user: {
    id: 1,
    name: 'Administrator',
    username: 'root',
    avatar_url: 'http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon',
    email: 'admin@example.com',
  },
  project: {
    id: 1,
    name: 'Gitlab Test',
    description: 'Aut reprehenderit ut est.',
    web_url: 'http://example.com/gitlabhq/gitlab-test',
    avatar_url: null,
    git_ssh_url: 'git@example.com:gitlabhq/gitlab-test.git',
    git_http_url: 'http://example.com/gitlabhq/gitlab-test.git',
    namespace: 'GitlabHQ',
    visibility_level: 20,
    path_with_namespace: 'gitlabhq/gitlab-test',
    default_branch: 'master',
    homepage: 'http://example.com/gitlabhq/gitlab-test',
    url: 'http://example.com/gitlabhq/gitlab-test.git',
    ssh_url: 'git@example.com:gitlabhq/gitlab-test.git',
    http_url: 'http://example.com/gitlabhq/gitlab-test.git',
  },
  repository: {
    name: 'Gitlab Test',
    url: 'http://example.com/gitlabhq/gitlab-test.git',
    description: 'Aut reprehenderit ut est.',
    homepage: 'http://example.com/gitlabhq/gitlab-test',
  },
  object_attributes: {
    id: 99,
    iid: 1,
    target_branch: 'master',
    source_branch: 'ms-viewport',
    source_project_id: 14,
    author_id: 51,
    assignee_ids: [6],
    assignee_id: 6,
    reviewer_ids: [6],
    title: 'MS-Viewport',
    created_at: '2013-12-03T17:23:34Z',
    updated_at: '2013-12-03T17:23:34Z',
    milestone_id: null,
    state: 'opened',
    blocking_discussions_resolved: true,
    work_in_progress: false,
    first_contribution: true,
    merge_status: 'unchecked',
    target_project_id: 14,
    description: '',
    url: 'http://example.com/diaspora/merge_requests/1',
    source: {
      name: 'Awesome Project',
      description: 'Aut reprehenderit ut est.',
      web_url: 'http://example.com/awesome_space/awesome_project',
      avatar_url: null,
      git_ssh_url: 'git@example.com:awesome_space/awesome_project.git',
      git_http_url: 'http://example.com/awesome_space/awesome_project.git',
      namespace: 'Awesome Space',
      visibility_level: 20,
      path_with_namespace: 'awesome_space/awesome_project',
      default_branch: 'master',
      homepage: 'http://example.com/awesome_space/awesome_project',
      url: 'http://example.com/awesome_space/awesome_project.git',
      ssh_url: 'git@example.com:awesome_space/awesome_project.git',
      http_url: 'http://example.com/awesome_space/awesome_project.git',
    },
    target: {
      name: 'Awesome Project',
      description: 'Aut reprehenderit ut est.',
      web_url: 'http://example.com/awesome_space/awesome_project',
      avatar_url: null,
      git_ssh_url: 'git@example.com:awesome_space/awesome_project.git',
      git_http_url: 'http://example.com/awesome_space/awesome_project.git',
      namespace: 'Awesome Space',
      visibility_level: 20,
      path_with_namespace: 'awesome_space/awesome_project',
      default_branch: 'master',
      homepage: 'http://example.com/awesome_space/awesome_project',
      url: 'http://example.com/awesome_space/awesome_project.git',
      ssh_url: 'git@example.com:awesome_space/awesome_project.git',
      http_url: 'http://example.com/awesome_space/awesome_project.git',
    },
    last_commit: {
      id: 'da1560886d4f094c3e6c9ef40349f7d38b5d27d7',
      message: 'fixed readme',
      timestamp: '2012-01-03T23:36:29+02:00',
      url: 'http://example.com/awesome_space/awesome_project/commits/da1560886d4f094c3e6c9ef40349f7d38b5d27d7',
      author: {
        name: 'GitLab dev user',
        email: 'gitlabdev@dv6700.(none)',
      },
    },
    labels: [
      {
        id: 206,
        title: 'API',
        color: '#ffffff',
        project_id: 14,
        created_at: '2013-12-03T17:15:43Z',
        updated_at: '2013-12-03T17:15:43Z',
        template: false,
        description: 'API related issues',
        type: 'ProjectLabel',
        group_id: 41,
      },
    ],
    action: 'open',
    detailed_merge_status: 'mergeable',
  },
};

// 排期任务列表
export const taskEnum = [
  {
    label: '需求熟悉/评审',
    value: '1',
  },
  {
    label: '需求排期',
    value: '2',
  },
  {
    label: '前端开发',
    value: '3',
  },
  {
    label: '后端开发',
    value: '4',
  },
  {
    label: '原生开发',
    value: '5',
  },
  {
    label: '大数据开发',
    value: '6',
  },
  {
    label: 'AI开发',
    value: '7',
  },
  {
    label: '前后端联调',
    value: '8',
  },
  {
    label: '用例编写',
    value: '9',
  },
  {
    label: '用例评审',
    value: '10',
  },
  {
    label: '测试',
    value: '11',
  },
  {
    label: '交叉测试',
    value: '12',
  },
  {
    label: '配合测试',
    value: '13',
  },
  {
    label: '配合上线',
    value: '14',
  },
  {
    label: '灰度验证',
    value: '15',
  },
  {
    label: '线上验证',
    value: '16',
  },
];

// 提测环境
export const environmentEnum = [
  {
    label: 'dev',
    value: 'dev',
  },
  {
    label: 'dev2',
    value: 'dev2',
  },
  {
    label: 'dev3',
    value: 'dev3',
  },
  {
    label: 'dev4',
    value: 'dev4',
  },
  {
    label: 'sit',
    value: 'sit',
  },
  {
    label: 'uat',
    value: 'uat',
  },
];

// 阶段开始时间
export const stageStartTime = {
  reviewTime: {
    key: 'reviewTime',
    type: [1],
    valueRule: 'min',
    title: '需求评审日期', // 需求熟悉/评审最早时间
  },
  entryTime: {
    key: 'entryTime',
    type: [3, 4, 5, 6, 7],
    valueRule: 'min',
    title: '开发进入日期', // 所有开发最早时间
  },
  jointTime: {
    key: 'jointTime',
    type: [8],
    valueRule: 'min',
    title: '进入联调日期', // 联调最早时间
  },
  smokeTime: {
    key: 'smokeTime',
    type: [9],
    valueRule: 'max',
    title: '冒烟提供日期', // 用例编写结束时间
  },
  subTestTime: {
    key: 'subTestTime',
    type: [8],
    valueRule: 'max',
    title: '整体提测日期', // 联调结束时间
  },
  TestTime: {
    key: 'TestTime',
    type: [11],
    valueRule: 'min',
    title: '介入测试日期', // 测试最早时间
  },
  acceptTime: {
    key: 'acceptTime',
    type: [11],
    valueRule: 'max',
    title: '预计验收日期', // 测试结束时间
  },
  onlineTime: {
    key: 'onlineTime',
    type: [16],
    valueRule: 'max',
    title: '预计上线日期', // 线上验证结束时间
  },
};

// 各阶段人员配置
export const userConfig = {
  1: '需求熟悉/评审',
  2: '需求排期',
  3: '前端开发',
  4: '后端开发',
  5: '原生开发',
  6: '大数据开发',
  7: 'AI开发',
  8: '联调',
  9: '用例编写',
  10: '用例评审',
  11: '测试',
  12: '交叉测试',
  13: '配合测试',
  14: '配合上线',
  15: '灰度验证',
  16: '线上验证',
};

// 详细排期-owner
export const detailPlanOwner = [
  {
    title: '技术Owner',
    key: 'index1',
  },
  {
    title: '提测环境',
    key: 'index2',
  },
  {
    title: '总工时',
    key: 'total',
  },
];

// 详细排期-时间
export const detailPlan = [
  {
    title: '需求熟悉/评审工时',
    keys: ['1'],
  },
  {
    title: '需求排期工时',
    keys: ['2'],
  },
  {
    title: '开发、联调工时',
    keys: ['3', '4', '5', '6', '7', '8'],
  },
  {
    title: '用例编写、测试、交叉测试工时',
    keys: ['9', '11', '12'],
  },
  {
    title: '配合测试工时',
    keys: ['13'],
  },
  {
    title: '配合上线工时',
    keys: ['14'],
  },
  {
    title: '灰度/线上验证工时',
    keys: ['15', '16'],
  },
];

// 详细排期-各阶段日期
export const detailPlanDate = [
  {
    title: '需求评审日期',
    key: 'reviewTime',
  },
  {
    title: '开发进入日期',
    key: 'entryTime',
  },
  {
    title: '进入联调日期',
    key: 'jointTime',
  },
  {
    title: '整体提测日期',
    key: 'subTestTime',
  },
  {
    title: '冒烟提供日期',
    key: 'smokeTime',
  },
  {
    title: '介入测试日期',
    key: 'TestTime',
  },
  {
    title: '预计验收日期',
    key: 'acceptTime',
  },
  {
    title: '预计上线日期',
    key: 'onlineTime',
  },
];

// 详细排期-开发人员时间
export const detailPlanUser = [
  {
    title: '前端开发人员',
    key: '3',
  },
  {
    title: '后端开发人员',
    key: '4',
  },
  {
    title: '原生开发人员',
    key: '5',
  },
  {
    title: '大数据开发人员',
    key: '6',
  },
  {
    title: 'AI开发人员',
    key: '7',
  },
  {
    title: '测试人员',
    key: '11',
  },
  {
    title: '联调人员',
    key: '8',
  },
];
